#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <map>
#include <queue>

using namespace std;

//Ориентированный взвешенный граф. NameType - тип уникального идентификатора вершины, 
//WightType - тип веса, обычно - double
template <typename NameType, typename WeightType>
class CGraph {
public:
    typedef NameType CVertexNameType;
    typedef WeightType CEdgeWeightType;
	
	struct CVertex {
		map <NameType, WeightType> outgoing, incoming;
	};
	
	map <NameType, CVertex> vertices;
	
	//Итератор рёбер
    class CEdgeIterator {
	public:
		bool inverse;
		NameType vertex;
		typename map <NameType, WeightType> :: iterator it;
		//Следующий элемент - можно заменить на оператор++
        void Next(){
			it++;
		}
        bool operator==( const CEdgeIterator& other ){
			return vertex == other.vertex && it == other.it;
		}
        //Текущее ребро: имя начальной и конечной вершины дуги
        pair<NameType, NameType> CurrentEdge(){
			if(inverse){
				return make_pair(it->first, vertex);
			}
			return make_pair(vertex, it->first);
		}
        //Вес текущего ребра
        WeightType CurrentWeight(){
			return it->second;
		}
    };
    //Диапазон исходящих из вершины дуг
    pair<CEdgeIterator, CEdgeIterator> GetOutgoingArcs( NameType v ){
		typename map <NameType, CVertex> :: iterator iter = vertices.find(v);
		CEdgeIterator begin;
		begin.inverse = false;
		begin.vertex = v;
		begin.it = iter->second.outgoing.begin();
		CEdgeIterator end;
		end.inverse = false;
		end.vertex = v;
		end.it = iter->second.outgoing.end();
		return make_pair(begin, end);
	}
    //Диапазон всходящих в вершину дуг
    pair<CEdgeIterator, CEdgeIterator> GetIncomingArcs( NameType v ){
		typename map <NameType, CVertex> :: iterator iter = vertices.find(v);
		CEdgeIterator begin;
		begin.inverse = true;
		begin.vertex = v;
		begin.it = iter->second.incoming.begin();
		CEdgeIterator end;
		end.inverse = true;
		end.vertex = v;
		end.it = iter->second.incoming.end();
		return make_pair(begin, end);
	}
    //Итератор вершин
    class CVertexIterator {
	private:
		typename map <NameType, CVertex> :: iterator it;
    public:
        //Следующий элемент - можно заменить на оператор++
        void Next(){
			it++;
		}
        bool operator==( const CEdgeIterator& other ){
			return it == other.it;
		}
        //Текущая вершина
        NameType CurrentVertex(){
			return it->first;
		}
    };
    //Все вершины
    pair<CVertexIterator, CVertexIterator> GetAllVertexes(){
		CVertexIterator begin;
		begin.it = vertices.begin();
		CVertexIterator end;
		end.it = vertices.end();
		return make_pair(begin, end);
	}
    //Добавление/удаление
    bool AddVertex( NameType v ){
		if(vertices.find(v) != vertices.end()){
			return false;
		}
		vertices[v];
	}
    bool DeleteVertex( NameType v ){
		typename map <NameType, CVertex> :: iterator iter = vertices.find(v);
		if(iter == vertices.end()){
			return false;
		}
		for(typename map <NameType, WeightType> :: iterator it = iter->second.outgoing.begin(); it != iter->second.outgoing.end(); it++){
			vertices[it->first].incoming.erase(v);
		}
		for(typename map <NameType, WeightType> :: iterator it = iter->second.incoming.begin(); it != iter->second.incoming.end(); it++){
			vertices[it->first].outgoing.erase(v);
		}
		vertices.erase(iter);
		return true;
	}
    bool AddEdge( NameType v, NameType u, WeightType weight ){
		typename map <NameType, CVertex> :: iterator iter_v = vertices.find(v);
		if(iter_v == vertices.end()){
			return false;
		}
		if(iter_v->second.outgoing.find(u) != iter_v->second.outgoing.end()){
			return false;
		}
		typename map <NameType, CVertex> :: iterator iter_u = vertices.find(u);
		if(iter_u == vertices.end()){
			return false;
		}
		iter_v->second.outgoing[u] = weight;
		iter_u->second.incoming[v] = weight;
		return true;
	}
    bool DeleteEdge( NameType v, NameType w ){
		typename map <NameType, CVertex> :: iterator iter = vertices.find(w);
		if(iter == vertices.end()){
			return false;
		}
		if(iter->second.outgoing.find(w) == iter->second.outgoing.end()){
			return false;
		}
		iter->second.outgoing.erase(w);
		iter = vertices.find(w);
		iter->second.incoming.erase(v);
		return true;
	}
    //Очистка
    void DeleteAll(){
		vertices.clear();
	}
};

class CMaxFlowFinder {
public:
	CGraph <int, int> graph;
	typename CGraph <int, int>::CVertexNameType source, sunk;
    CMaxFlowFinder( CGraph<int, int>& _graph, typename CGraph<int, int>::CVertexNameType _source, typename CGraph<int, int>::CVertexNameType _sunk ){
		graph = _graph;
		source = _source;
		sunk = _sunk;
	}
    //Найти максимальный поток
    typename CGraph<int, int>::CEdgeWeightType FindMaxFlow(){
		typename CGraph <int, int>::CEdgeWeightType flow = 0;
		while(true){
			set <typename CGraph <int, int>::CVertexNameType> used;
			map <typename CGraph <int, int>::CVertexNameType, typename CGraph <int, int>::CVertexNameType> prev;
			queue <typename CGraph <int, int>::CVertexNameType> q;
			used.insert(source);
			q.push(source);
			while(!q.empty()){
				typename CGraph <int, int>::CVertexNameType cur = q.front();
				q.pop();
				pair <typename CGraph <int, int>::CEdgeIterator, typename CGraph <int, int>::CEdgeIterator> iters = graph.GetOutgoingArcs(cur);
				for(typename CGraph <int, int>::CEdgeIterator it = iters.first; !(it == iters.second); it.Next()){
					pair <typename CGraph <int, int>::CVertexNameType, typename CGraph <int, int>::CVertexNameType> edge = it.CurrentEdge();
					if(it.CurrentWeight() > 0 && used.find(edge.second) == used.end()){
						used.insert(edge.second);
						prev[edge.second] = cur;
						q.push(edge.second);
					}
				}
			}
			if(used.find(sunk) == used.end()){
				break;
			}
			flow++;
			typename CGraph <int, int>::CVertexNameType cur = sunk;
			while(cur != source){
				typename CGraph <int, int>::CVertexNameType ver = prev[cur];
				graph.vertices[ver].outgoing[cur]--;
				graph.vertices[cur].outgoing[ver]++;
				cur = ver;
			}
		}
		return flow;
	}
};

int main(){
	string a;
	cin >> a;
	int n;
	cin >> n;
	CGraph <int, int> g;
	for(int i = 0; i < (int)a.size(); i++){
		g.AddVertex(i);
	}
	for(int i = 0; i < n; i++){
		string b;
		cin >> b;
		g.AddVertex((int)a.size() + i);
		for(int j = 0; j < (int)a.size(); j++){
			for(int z = 0; z < (int)b.size(); z++){
				if(a[j] == b[z]){
					g.AddEdge(j, (int)a.size() + i, 1);
					g.AddEdge((int)a.size() + i, j, 0);
					break;
				}
			}
		}
	}
	int source = (int)a.size() + n;
	int sunk = source + 1;
	g.AddVertex(source);
	g.AddVertex(sunk);
	for(int i = 0; i < (int)a.size(); i++){
		g.AddEdge(source, i, 1);
		g.AddEdge(i, source, 0);
	}
	for(int i = 0; i < n; i++){
		g.AddEdge((int)a.size() + i, sunk, 1);
		g.AddEdge(sunk, (int)a.size() + i, 0);
	}
	CMaxFlowFinder flow(g, source, sunk);
	if(flow.FindMaxFlow() == (int)a.size()){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
	return 0;
}
